﻿using UnityEngine;
using System.Collections;

namespace  Inlycat.AI.BehaviorTree
{

    public class ActionAttack : BNodeAction
    {
        private bool over;
        private float m_fTime;

        public ActionAttack() : base()
        {
            this.m_StrName = "Attack";
        }

        public override void OnEnter(BInput input)
        {
            TestInput tInput = input as TestInput;
            tInput.hp -= 20;
            this.m_fTime = Time.time;
            this.over = false;
            Debug.Log("attack");
        }

        public override ActionResult Execute(BInput input)
        {
            if (Time.time - this.m_fTime > 2f)
            {
                this.over = true;
            }

            if (this.over)
            {
                return ActionResult.SUCCESS;
            }

            return ActionResult.RUNNING;
        }
    }

    public class TestInput : BInput
    {
        public int hp = 100;
        public int mp = 200;
    }

}